package dca;

import java.io.IOException;

public abstract class Cure {
	
	private String name;
	private int healFactor;
	private String type;
	
	public Cure(String type,String name,int healFactor){
		this.name=name;
		this.healFactor = healFactor;
		this.type = type;
	}
	
	/**
	 * Administers the cure to a patient. This will heal him/her, but only if he/she is suffering from the decease treated by the cure.
	 * @param aPatient
	 * @throws IOException 
	 */
	public void administer(Patient aPatient) throws IOException{
		//Uses a doctor to check matching cure/disease
		Doctor drCheck = new Doctor();
		if(drCheck.diagnose(aPatient).getCure().getName().equalsIgnoreCase(name))
			aPatient.heal(healFactor);
	}
	
	public String toString(){
		return this.type+", "+this.name +", "+ String.valueOf(this.healFactor);
	}
	
	public String getName(){
		return this.name;
	}

}


